package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Announce;
import com.hzdl.car.mapper.AnnounceMapper;
import com.hzdl.car.service.AnnounceService;
import com.hzdl.car.vo.AnnounceVo;
import com.hzdl.car.vo.AnnounceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AnnounceServiceImpl implements AnnounceService {
    @Autowired
    private AnnounceMapper am;
    @Override
    public PageInfo findAnnouncebyWhere(AnnounceVo announceVo) {
        PageHelper.startPage(announceVo.getPage(),announceVo.getLimit());
        List<Announce> aList = am.findAnnouncebyWhere(announceVo);
        PageInfo pageInfo = new PageInfo(aList);
        return pageInfo;
    }

    @Override
    public int deleteNewsById(Integer id) {
        return am.deleteNewsById(id);
    }

    @Override
    public int insertNews(AnnounceVo announceVo) {
        return am.insertNews(announceVo);
    }

    @Override
    public int updateNews(AnnounceVo announceVo) {
        return am.updateNews(announceVo);
    }

    @Override
    public List<Announce> findAllAnnounce() {
        return am.findAllAnnounce();
    }
}
